.cont-root {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-color: #F2F2F2;
  padding: 12px 12px;
  height: calc(100vh - 69px);
  overflow-y: auto;

  :global{
    // 样式覆盖
  .ant-select-selection-placeholder {
    color: #000;
  }

  .ant-select-arrow {
    color: #000;
  }
  }
}


.cont-right {
  background: transparent;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.cont-header {
  z-index: 1;
  background: #fff;
  // height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 12px;
  height: 60px;
  border-radius: 8px;

  // make selects look borderless consistently
  :global(.ant-select-selector) {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  :global(.ant-select-focused .ant-select-selector) {
    box-shadow: none !important;
  }

  :global(.ant-select:hover .ant-select-selector) {
    border: none !important;
  }
  
  // 去掉数据源筛选 Popover 内部容器的 padding
  :global(.ant-popover-inner-content) {
    padding: 0 !important;
  }
}

.cont-side {
  overflow: auto;
  border-radius: 8px;
  height: 100%;
  /* Tree 样式优化，贴近设计稿 */
  :global(.ant-tree) {
    background: #fff;
    padding: 6px 8px;
    font-size: 14px;
    color: #374151;
  }
  .tree-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
  }
  .tree-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .tree-count {
    min-width: 22px;
    height: 20px;
    line-height: 20px;
    border-radius: 10px;
    background: #eef2f6;
    color: #4b5563;
    font-size: 12px;
    text-align: center;
    padding: 0 6px;
  }
  :global(.ant-tree-treenode) {
    padding: 2px 6px;
    margin: 0;
    border-radius: 6px;
  }
  :global(.ant-tree-treenode:hover) {
    background: #f5f7fb;
  }
  :global(.ant-tree-treenode-selected) {
    background: #e6f4ff !important; /* 选中为浅蓝底 */
  }
  :global(.ant-tree-treenode-selected > .ant-tree-node-content-wrapper) {
    color: #1677ff; /* 浅蓝底上蓝字 */
    font-weight: 600;
    background-color: transparent;
  }
  :global(.ant-tree-node-content-wrapper) {
    padding: 6px 6px;
    border-radius: 6px;
    color: #4b5563;
  }
  :global(.ant-tree-switcher) {
    color: #9aa1ab;
    line-height: 36px;
  }
  :global(.ant-tree-indent-unit) {
    width: 16px; /* 缩进适中 */
  }
  :global(.ant-tree-treenode-selected) {
    position: relative;
  }
  :global(.ant-tree-treenode-selected)::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
    background: #1677ff; /* 选中左侧强调条 */
  }
  :global(.ant-tree-treenode-selected .ant-tree-switcher),
  :global(.ant-tree-treenode-selected .ant-tree-switcher .anticon) {
    color: #1677ff;
  }
}

.cont-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  position: relative;

  .cont-listBody {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    height: 100%;
    background-color: #fff;
    border-radius: 8px;
    padding: 12px 12px;
  }
}

.cont-card {
  position: relative;
  background: #f6f9ff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  /* 未选中灰色边框 */
  transition: box-shadow .3s ease, background-color .3s ease, border-color .3s ease;
  margin-bottom: 16px;
}

.cont-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
  background: #e5e7eb;
  /* 灰色侧边条，未选中 */
  transition: background-color .3s ease, background .3s ease;
}

.cont-card:hover {
  border-color: #d6d9de;
  /* hover 时略深的灰 */
  box-shadow: 0 2px 8px rgba(22, 119, 255, 0.06);
}

.cont-card.is-active {
  background: #eef5ff;
  border-color: rgba(22, 119, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15) inset;
}

.cont-card.is-active::before {
  background: #1677ff;
}

/* 显式导出一个激活类，避免 CSS Modules 组合选择器导致的未命中 */
.activeCard {
  background: #eef5ff;
  border-color: rgba(22, 119, 255, 0.35);
  box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.15) inset;
}
.activeCard::before {
  background: #1677ff;
}

.cont-card-header {
  color: #7a8aaa;
  margin-bottom: 6px;
}

.cont-card-title {
  font-size: 16px;
  color: #1677ff;
  font-weight: 600;
  margin-bottom: 6px;
}

.cont-card-desc {
  color: #666;
}

.cont-card-footer {
  margin-top: 8px;
}

.cont-detail {
  overflow: auto;
  border-radius: 8px;
  height: 100%;
}

.cont-detail-desc {
  white-space: pre-wrap;
}

// 数据源筛选器样式
.data-source-trigger {
  padding: 0 8px !important;
  min-width: 120px;
  max-width: 400px; // 增加最大宽度，显示更多内容
  text-align: left;
  display: flex;
  align-items: center;
  height: 32px;
  border: none !important;
  border-radius: 0;
  background-color: transparent;
  color: rgba(0, 0, 0, 0.88);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
  box-shadow: none !important;
  
  &:hover {
    color: #1890ff;
  }
  
  &:focus {
    outline: none;
    box-shadow: none;
  }
}

.data-source-label {
  // color: rgba(0, 0, 0, 0.45);
  color: #000;
  margin-right: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.data-source-placeholder {
  flex: 1;
  color: #000;
  margin-right: 8px;
}

.data-source-trigger-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 8px;
  color: #1890ff;
  max-width: 150px;
  line-height: 1;
  display: inline-block;
}

.data-source-arrow {
  font-size: 12px;
  color: #000;
  flex-shrink: 0;
  transition: transform 0.3s;
  margin-left: auto;
  
  .data-source-trigger:hover & {
    color: #4096ff;
  }
}

.data-source-filter {
  width: 280px;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  
  // 去掉 Popover 内部容器的 padding
  :global {
    .ant-popover-inner-content {
      padding: 0 !important;
    }
  }
}

.data-source-search {
  margin-bottom: 12px;
  
  :global(.ant-input) {
    border-radius: 6px;
    height: 24px;
    transition: all 0.2s;
    
    &:hover {
      border-color: #40a9ff;
    }
    
    &:focus,
    &:focus-within {
      border-color: #40a9ff;
      box-shadow: 0 0 0 2px rgba(64, 169, 255, 0.2);
    }
  }
  
  // 确保 Input 包装器没有额外的边框
  :global(.ant-input-affix-wrapper) {
    border-radius: 6px;
    
    &:hover {
      border-color: #40a9ff;
    }
    
    &:focus,
    &:focus-within {
      border-color: #40a9ff;
      box-shadow: 0 0 0 2px rgba(64, 169, 255, 0.2);
    }
  }
}

.data-source-list {
  height: 180px; // 固定高度
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 12px;
  padding: 4px 8px;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  background: #fafafa;
  
  :global(.ant-checkbox-group) {
    width: 100%;
    display: flex;
    flex-direction: column;
  }
  
  // 自定义滚动条样式 - 更美观
  &::-webkit-scrollbar {
    width: 8px;
  }
  
  &::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
  }
  
  &::-webkit-scrollbar-thumb {
    background: #bfbfbf;
    border-radius: 4px;
    transition: background 0.2s;
    
    &:hover {
      background: #999;
    }
  }
  
  // Firefox 滚动条样式
  scrollbar-width: thin;
  scrollbar-color: #bfbfbf #f5f5f5;
}

.data-source-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  width: 100%;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s;
  
  :global(.ant-checkbox-wrapper) {
    flex: 1;
    display: flex;
    align-items: center;
    margin-right: 0;
    
    :global(.ant-checkbox) {
      margin-right: 8px;
    }
  }
  
  &:hover {
    background-color: #e6f7ff;
  }
  
  &:active {
    background-color: #bae7ff;
  }
}

.data-source-count {
  color: #666;
  font-size: 14px;
  flex-shrink: 0;
  margin-left: 8px;
  min-width: 30px;
  text-align: right;
}

.data-source-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
  margin-top: 0;
  
  :global(.ant-btn) {
    height: 32px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
  }
  
  :global(.ant-btn-primary) {
    background-color: #1890ff;
    border-color: #1890ff;
    
    &:hover {
      background-color: #40a9ff;
      border-color: #40a9ff;
    }
    
    &:active {
      background-color: #0958d9;
      border-color: #0958d9;
    }
  }
  
  :global(.ant-btn):not(:global(.ant-btn-primary)) {
    background-color: #fff;
    border-color: #d9d9d9;
    color: #595959;
    
    &:hover {
      color: #1890ff;
      border-color: #1890ff;
    }
    
    &:active {
      color: #0958d9;
      border-color: #0958d9;
    }
  }
}